﻿<UserControl x:Class="ForumsBrowser.ThreadListItem"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:fp="clr-namespace:ForumsBrowser"
    HorizontalAlignment="Stretch"
    Height="52" Margin="0,2,2,2" 
    Loaded="UserControl_Loaded" Unloaded="UserControl_Unloaded"
    MouseLeftButtonDown="UserControl_MouseLeftButtonDown" x:Name="userControl"
    ToolTipService.InitialShowDelay="1500" ToolTipService.ShowDuration="30000">
    <UserControl.Resources>
        <ResourceDictionary>
            <Storyboard x:Key="shrink">
                <DoubleAnimation Duration="0:0:1" From="20" To="30" Storyboard.TargetProperty="Height"/>
                <DoubleAnimation Duration="0:0:1" From="30" To="0" Storyboard.TargetProperty="Height"/>
            </Storyboard>
            <Style TargetType="TextBlock">
                <Setter Property="FontSize" Value="10"/>
            </Style>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="DefaultStyle.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <UserControl.ToolTip>
        <fp:ThreadTooltip/>
    </UserControl.ToolTip>
    <Grid>
        <Grid Grid.Row="1" HorizontalAlignment="Stretch">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" MinWidth="175"/>
                <ColumnDefinition Width="125"/>
                <ColumnDefinition Width="150"/>
                <ColumnDefinition Width="150"/>
            </Grid.ColumnDefinitions>
            <TextBlock VerticalAlignment="Center" FontSize="16" Grid.Column="0" 
                       HorizontalAlignment="Stretch" TextWrapping="Wrap" 
                       Grid.Row="0" TextTrimming="CharacterEllipsis"
                       Text="{Binding Path=Title, FallbackValue=This is what we show in the designer this is some more text we might show and yet some more text we might show we really want this to overflow alot}" 
                       Margin="0,0,0,0" />
            <StackPanel Grid.Column="1" Orientation="Vertical" VerticalAlignment="Center" Margin="2,2,2,2">
                <TextBlock Text="{Binding Path=ForumName}"/>
                <TextBlock>
                    <TextBlock.Text>
                        <MultiBinding StringFormat="{}Replies: {0}">
                            <Binding Path="Replies"/>
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
                <TextBlock>
                    <TextBlock.Text>
                        <MultiBinding StringFormat="{}Views: {0}">
                            <Binding Path="Views"/>
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
            </StackPanel>
            <fp:UserTokenControl Grid.Column="2" User="{Binding Author}" DateValue="{Binding CreatedOn}"/>
            <fp:UserTokenControl Grid.Column="3" User="{Binding LastReplier}" DateValue="{Binding LastRepliedOn}" 
                                 Visibility="{Binding Path=HasReplies, Converter={StaticResource BoolVis} }"/>
        </Grid>
        <fp:NewThreadNotification HorizontalAlignment="Left" Visibility="{Binding Path=IsNew, Converter={StaticResource BoolVis} }"/>
    </Grid>
</UserControl>
